﻿
using AutoMapper;
using Data.Models;
using QuanLySanXuat.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace QuanLySanXuat.Mappers
{
    public class EntityToViewModelMappingProfile : Profile
    {
        public override string ProfileName
        {
            get { return "EntityToViewModelMappings"; }
        }

        protected override void Configure()
        {
            //map(from a, to b):a->b
            Mapper.CreateMap<ProductType, ProductTypeFormModels>();
            Mapper.CreateMap<Category, CategoryFormModels>();
            Mapper.CreateMap<Contact, ContactFormModels>();
            Mapper.CreateMap<Company, CompanyFormModels>();
            Mapper.CreateMap<Currency, CurrencyFormModels>();
            Mapper.CreateMap<ActualGoodInStock, ActualGoodInStockFormModels>();
            Mapper.CreateMap<Product, ProductFormModels>();
            Mapper.CreateMap<Purchase, PurchaseFormModels>();
            Mapper.CreateMap<PurchaseDetail, PurchaseDetailFormModels>();
            Mapper.CreateMap<User, UserFormModels>();
            Mapper.CreateMap<UOM, UOMFormModels>();
            Mapper.CreateMap<Stock, StockFormModels>();
            Mapper.CreateMap<Machine, MachineFormModels>();
            Mapper.CreateMap<Material, MaterialFormModels>();
            Mapper.CreateMap<MaterialType, MaterialTypeFormModels>();
            Mapper.CreateMap<BOM, BOMFormModels>();
            Mapper.CreateMap<BOMDetail, BOMDetailFormModels>();
            Mapper.CreateMap<Accessory, AccessoryFormModels>();
            Mapper.CreateMap<WorkerLevel, WorkerLevelFormModels>();
            Mapper.CreateMap<BOMAccessorie_Details, BOMAccessorie_DetailsFormModels>();
            Mapper.CreateMap<BOMWorker_Details, BOMWorker_DetailsFormModels>();
            Mapper.CreateMap<BOMMachine_Details, BOMMachine_DetailsFormModels>();

            //Dung cho khoi ProductModel
            Mapper.CreateMap<ToolFormula, ToolFormulaFormModels>();
            Mapper.CreateMap<ToolType, ToolTypeFormModels>();
            Mapper.CreateMap<OtherCost, OtherCostFormModels>();
            Mapper.CreateMap<OtherCostFormula, OtherCostFormulaFormModels>();
            Mapper.CreateMap<DesignDetail, DesginDetailFormModels>();
            Mapper.CreateMap<MaterialFormula, MaterialFormulaFormModels>();
            Mapper.CreateMap<LabourFormula, LabourFormulaFormModels>();
            Mapper.CreateMap<ProductModel, ProductModelFormModels>();
            //
            Mapper.CreateMap<LevelNorm, LevelNormFormModels>();
            Mapper.CreateMap<ToolNorm, ToolNormFormModels>();
            //Du lieu tham chieu
            Mapper.CreateMap<Unit, UnitFormModels>();
            Mapper.CreateMap<Employee, EmployeeFormModels>();
            Mapper.CreateMap<Workplace, WorkplaceFormModels>();

            //Dung cho lenh san xuat
            Mapper.CreateMap<Order, OrderFormModels>();
            Mapper.CreateMap<MaterialDetail, MaterialDetailFormModels>();
            Mapper.CreateMap<ToolDetail, ToolDetailFormModels>();
            Mapper.CreateMap<OtherCostDetail, OtherCostDetailFormModels>();
            Mapper.CreateMap<LabourDetail, LabourDetailFormModels>();

            //Dung cho thuc hien san xuat
            Mapper.CreateMap<OrderProcess, OrderProcessFormModels>();
            Mapper.CreateMap<CostDetail, CostDetailFormModels>();
            Mapper.CreateMap<SubprocessDetail, SubprocessDetailFormModels>();

            //Dung cho ket thuc san xuat
            Mapper.CreateMap<OrderSummary, OrderSummaryFormModels>();
            Mapper.CreateMap<StorageDetail, StorageDetailFormModels>();

            //Dung cho phieu xuat
            Mapper.CreateMap<BillOut, BillOutFormModels>();
            Mapper.CreateMap<BillDetail, BillDetailFormModels>();
        }
    }
}

